# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=yelp-tools
pkgver=3.32.2
pkgrel=1
pkgdesc="Tools for creating Yelp documentation"
arch=('any')
license=('GPL')
url="https://www.gnome.org"
depends=("yelp-xsl" "itstool" "libxslt-python" "libxml2-python")
options=('strip' '!libtool' 'staticlibs')
makedepends=("libxml2-python" "libxslt-python" "intltool" "itstool")
source=(https://download.gnome.org/sources/${pkgname}/${pkgver:0:4}/${pkgname}-$pkgver.tar.xz
        yelp-no-symlinks.patch)
sha256sums=('183856b5ed0b0bb2c05dd1204af023946ed436943e35e789afb0295e5e71e8f9'
            '276286ade313f9c31a990e77742b20a34c59d50f84a21e5d05c38e5a8ee654be')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/yelp-no-symlinks.patch
  autoreconf -ivf
}

build() {
  mkdir -p ${srcdir}/build-${CHOST} && cd ${srcdir}/build-${CHOST}
  export PYTHON=/usr/bin/python2
  ${srcdir}/${pkgname}-${pkgver}/configure \
    --prefix=/usr \
    --build=${CHOST} \
    --host=${CHOST}

  make
}

check() {
  cd ${srcdir}/build-${CHOST}
  make -k check
}

package() {
  cd ${srcdir}/build-${CHOST}
  make DESTDIR="${pkgdir}" install
  for ff in yelp-build yelp-check yelp-new; do
    sed -e "s| xsltproc| /usr/bin/xsltproc|g" -i ${pkgdir}/usr/bin/$ff
  done
}
